<template>
  <footer class="footer">
    <span class="todo-count"
      ><strong>{{ sum }}</strong
      >剩余</span
    >
    <ul class="filters">
      <li>
        <a :class="{selected:type==='all'}" href="#/" @click='changeType("all")'>全部</a>
      </li>
      <li>
        <a :class="{selected:type==='active'}" href="#/active" @click='changeType("active")'>进行中</a>
      </li>
      <li>
        <a :class="{selected:type==='completed'}" href="#/completed" @click='changeType("completed")'>已完成</a>
      </li>
    </ul>
    <button class="clear-completed" v-show="clearBtn" @click="clearAll">
      清除已完成
    </button>
  </footer>
</template>

<script>
export default {
  name: 'TodoListFooter',
  components: {},
  props: {
    sum: {
      required: true,
      type: Number,
    },
    clearBtn: {
      required: true,
      type: Boolean,
    },
    type: {
      required: true,
      type: String,
    },
  },
  data() {
    return {}
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    clearAll() {
      this.$emit('clearAll')
    },
    changeType(value){
      this.$emit('changeType',value)
    }
  },
}
</script>

<style scoped></style>
